package com.kevin.tools.data.mapper;


public class NameMapper implements Mapper{

	public  int priority;
	
	public NameMapper(int priority) {
		super();
		this.priority = priority;
	}

	@Override
	public boolean map(Data left, Data right) {
		String leftName = left.getName();
		String rightName = right.getName();
		if(StringUtils.isNotBlank(leftName)&&StringUtils.isNotBlank(rightName)){
			leftName = leftName.toLowerCase().trim().replace("_","");
			rightName=rightName.toLowerCase().trim().replace("_","");
			if(leftName.equals(rightName)){
				return true;
			}
		}
		return false;
	}
	
	public int getPriority() {
		return priority;
	}

	public void setPriority(int priority) {
		this.priority = priority;
	}
	
	@Override
	public int compareTo(Mapper o) {
		if(priority>o.getPriority())
			return 1;
		else if(priority==o.getPriority())
			return 0;
		else
		    return -1;
	}


}
